package cn.hr.dao.mapper;

import cn.hr.pojo.SysUserRole;
import org.apache.ibatis.annotations.Param;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by MO on 2018/12/25.
 */
public interface SysUserRoleMapper {
    List<SysUserRole> findByUserId(@Param("userId") Integer userId) throws SQLException;


    /**
     * 新增
     *
     * @return
     * @throws SQLException
     */
    int insert(SysUserRole sysUserRole) throws SQLException;

    /**
     * 根据id修改
     *
     * @return
     * @throws SQLException
     */
    int update(SysUserRole sysUserRole) throws SQLException;

    /**
     * 根据 user_id删除
     *
     * @param id
     * @return
     * @throws SQLException
     */
    int delete(@Param("id") Integer id) throws SQLException;

    /**
     * 根据用户id查询角色id
     * @param userId
     * @return
     * @throws SQLException
     */
    Integer getRoleIdByUserId(@Param("user_id")Integer userId) throws SQLException;
}
